package com.djx.comm;

import java.util.HashMap;
import java.util.Map;

public class Constant {
    public static final String PROJECT_NAME = "hrp:";

    //斜杠
    public static final String SPRIT = "/";
    //默认生成图片文件名长度
    public static final int PHOTO_LEN = 8;
    //HRP_TOKEN
    public static final String HRP_TOKEN = "HRP_TOKEN";

    //图片生成精度
    public static final float IMG_PER = 2;
    //图片截取正文形坐标
    public static final Integer[] IMG_CUT_X_Y = {0, 20};

    //进程相关参数
    public static int COMPLETE_NUM = 0;  //已完成数量
    public static int THREAD_NUM = 0;   //当前线程数量
    //等待队列
    public static final String WAIT_FOR_CALCULATE = Constant.PROJECT_NAME + "waitForCalculate";
    //执行队列
    public static final String CALCULATING = Constant.PROJECT_NAME + "calculating";
    //同步时间
    public static final String SYNA_PHOTO_END_TIME = Constant.PROJECT_NAME + "synaPhotoEndTime";

    //aes.key
    public static final String SALT = "1gqaz@SX#EDC4rfv";

    /**
     *下载Material
     */
    public static final String DOWNLOAD_PATH="material/download/";

    /**
     * 状态-可用
     */
    public static final String STATUS_ENABLED="enabled";
    /**
     * 状态-禁用
     */
    public static final String STATUS_DISABLED="disabled";
    /**
     * APP请求类型
     */
    public static final String APP_TYPE="SSO";

    /**
     * SimpleDateFormat常量
     */
    public static final String DATE_TIME = "yyyy-MM-dd HH:mm:ss";
    public static final String DATE = "yyyy-MM-dd";
    public static final String TIME = "HH:mm:ss";


    /**
     * PS接口返回的失败标识
     */
    public static final String STRING_FAIL = "FAIL";

    /**
     * 查询薪资的短信提示
     */
    public static String getSmsContent(String code){
        return "您的验证码为: "+code+",有效时间为1分钟.请尽快操作";
    }

    /**
     * 规则运算 对应的KEY
     */
    public static final String RULE_OPERATION_ID_GREATER = "greater";// 大于
    public static final String RULE_OPERATION_ID_LESS = "less";// 小于
    public static final String RULE_OPERATION_ID_GREATER_EQUAL = "greater_equal";// 大于等于
    public static final String RULE_OPERATION_ID_LESS_EQUAL = "less_equal";// 小于等于
    public static final String RULE_OPERATION_ID_EQUAL = "equal";//等于
    public static final String RULE_OPERATION_ID_CONTAIN = "contain";// 包含
    public static final String RULE_OPERATION_ID_NOT_EQUAL = "not_equal";//不等于

    /**
     * 规则字段 对应的KEY
     */
    public static final String RULE_FIELD_KEY_BIRTH = "birthdateMMDD";
    public static final String RULE_FIELD_KEY_ORIGIN = "origin";
    public static final String RULE_FIELD_KEY_MAR_STATUS = "maritalStatus";
    public static final String RULE_FIELD_KEY_SEX = "sex";
    public static final String RULE_FIELD_KEY_SCHOOL = "school_descr";
    public static final String RULE_FIELD_KEY_EDUCATION = "degree";
    public static final String RULE_FIELD_KEY_SCHOOL_COUNTRY = "school_country_cd";

    /**
     * 获取PS的业务流水号
     */
    public static final class PsCrcTxnNumTbl{
        /**
         * 业务流水号前缀
         */
        public static final String SERIAL_NUM_PREFIX_1 = "1";
        public static final String SERIAL_NUM_PREFIX_2 = "2";

        /**
         * 业务流水号条件 对应数据库key(CRC_TXN_NAME字段)
         */
        public static final String SERIAL_NUM_KEY_1 = "1";//修改用户信息处理ID的流水号key条件
        public static final String SERIAL_NUM_KEY_MANGO = "CRC_MANGO_SN";//修改电话号码的专用流水号key条件
    }

    /**
     * 字符串 Y
     */
    public static final String STRING_Y = "Y";

    /**
     * 字符串 N
     */
    public static final String STRING_N = "N";

    /**
     * 审核状态 已提交
     */
    public static final String CRC_APPR_STATUS_SUBMITTED = "02";

    /**
     * 字符串 空格
     */
    public static final String STRING_SPACE = " ";

    /**
     * 数字 0
     */
    public static final int INT_ZERO = 0;

    /**
     * 处理状态 NS
     */
    public static final String CRC_STATUS_NS = "NS";

    /**
     * 电话类型 CELL
     */
    public static final String PHONE_TYPE_CELL = "CELL";

    /**
     * 操作类型
     */
    public static final String OPERATION_TYPE_INSERT = "I";
    public static final String OPERATION_TYPE_DELETE = "D";
    public static final String OPERATION_TYPE_UPDATE_BEFORE = "O";
    public static final String OPERATION_TYPE_UPDATE_AFTER = "U";

    /**
     * 登录操作类型
     */
    public static final String OPR_TYPE_0 = "0";//登出
    public static final String OPR_TYPE_1 = "1";//登入

    /**
     * 登录类型
     */
    public static final String LOGIN_TYPE_0 = "0";//普通登陆
    public static final String LOGIN_TYPE_1 = "1";//单点登录

    /**
     * 系统类型
     */
    public static final String CONFIG_TYPE_STRING = "string";
    public static final String CONFIG_TYPE_OBJECT = "object";
    public static final String CONFIG_TYPE_LIST = "list";

    /**
     * redis 过期时间
     */
    public static final int EXPIRE_TIME_1_DAY = 86400;

    //用户照片文件类型
    public static final String[] USER_PHOTO_FILE_TYPE = {
            "A",  //一寸照片
            "B"   //正方形
    };

    //符号
    public static final String IMG_SIGN = "x";
    //下划线
    public static final String UNDERLINE = "_";
    //点
    public static final String DOT = ".";
    //默认生成图片类型
    public static final String IMG_TYPE = "jpg";
    //1寸   打印尺寸25×35(mm)  像素295×413(px)
    public static final int IMG_WIDTH = 148;
    public static final int IMG_HEIGHT = 207;

    public static final int REGION_WIDTH = 400;
    public static final int REGION_HEIGHT = 400;

    //返回不同图片类型对应的名称
    public static String getPhotoFileName(String fileType) {
        String name = "";
        switch (fileType){
            case "A":
                name = UNDERLINE + IMG_WIDTH + IMG_SIGN + IMG_HEIGHT + DOT + IMG_TYPE;
                break;
            case "B":
                name = UNDERLINE + IMG_WIDTH + IMG_SIGN + IMG_WIDTH + DOT + IMG_TYPE;
                break;
            default:
        }
        return name;
    }

    /**
     * 表名常量定义
     */
    public static final class TableName{
        //mysql:员工照片同步缓存表（全量）
        public static final String empl_photo_temp = "empl_photo_temp";
        //mysql:员工照片字节流缓存表
        public static final String empl_photo_bytes_temp = "empl_photo_bytes_temp";
        //mysql:员工日期同步缓存表（全量）
        public static final String empl_basic_date_temp = "empl_basic_date_temp";
        //mysql:员工日期同步缓存表（全量）
        public static final String PS_MANGO_CRC_INF_ORG_CUR = "PS_MANGO_CRC_INF_ORG_CUR";
        //mysql:员工日期同步缓存表（全量）
        public static final String PS_MANGO_CRC_PSN_CUR_VW_TEMP = "PS_MANGO_CRC_PSN_CUR_VW_TEMP";
        //mysql:员工日期同步缓存表（全量）
        public static final String PS_MANGO_CRC_JOB_CUR_VW_TEMP = "PS_MANGO_CRC_JOB_CUR_VW_TEMP";
        //mysql:员工日期同步缓存表（全量）
        public static final String hrp_im_file_info = "hrp_im_file_info";
        //mysql:HR工作台在职人数（全量）
        public static final String hrp_incumbent_cnt = "hrp_incumbent_cnt";
        //mysql:HR工作台本年入职人数（全量）
        public static final String hrp_entry_cnt = "hrp_entry_cnt";
        //mysql:HR工作台本年离职人数（全量）
        public static final String hrp_leave_cnt = "hrp_leave_cnt";
    }

    /**
     * 修改用户信息相关参数
     * @Author: WangHui
     * @CreateDate: 2017/4/11 16:51
     */
    public static final class recordField {
        public static final Map<String,String[]> PHONE_LOG_MAP = new HashMap<String,String[]>();
        static{
            //Map的Key对应的字段，FIELD_NAME：字段名
            //String[]对应的字段，CRC_DESC：字段描述、CRC_NEW_VALUE：新值
            PHONE_LOG_MAP.put("PHONE_TYPE",new String[]{"电话类型","移动电话"});
            PHONE_LOG_MAP.put("PHONE",new String[]{"电话",""});
            PHONE_LOG_MAP.put("PREF_PHONE_FLAG",new String[]{"首选","N"});
        }

        /** 电话号码 */
        public static final String RECORD_PERSONAL_PHONE = "PERSONAL_PHONE";

        /** 电话类型 */
        public static final String FIELD_PHONE_TYPE = "PHONE_TYPE";

        /** 电话 */
        public static final String FIELD_PHONE = "PHONE";

        /** 电话是否首选 */
        public static final String FIELD_PREF_PHONE_FLAG = "PREF_PHONE_FLAG";

        /** 移动电话号码 */
        public static final String FIELD_PHONE_TYPE_CELL = "CELL";

        /** 电话容器表表名 */
        public static final String CONTAINER_CRC_PHO_INFO_VW = "CRC_PHO_INFO_VW";

        /** 审批状态 01-审批中，02-已审核，03-已驳回 */
        public static final String APPROVAL_STA_01 = "01";

        /** 修改类型 内地 */
        public static final String MDYINFO_TYPE_GRXX = "GRXX";

        /** 修改类型 香港 */
        public static final String MDYINFO_TYPE_GRHK = "GRHK";

        /** 邮件发送状态 YFS-已发送 */
        public static final String STRING_YFS = "YFS";

        /** 用户提供的许可权 */
        public static final String CLASSID_CRC_EE_C006 = "CRC_EE_C006";

    }

    public static String getOprName(String oprType) {
        String name = "";
        if(null != oprType && !"".equals(oprType.trim())){
            switch (oprType){
                case "I":
                    name = "新增";
                    break;
                case "U":
                    name = "更新";
                    break;
                case "D":
                    name = "删除";
                    break;
                default:
            }
        }
        return name;
    }

    public static final class NumberStr{
        public static final String ZERO = "0";
        public static final String ONE = "1";
        public static final String TWO = "2";
        public static final String THREE = "3";
        public static final String FOUR = "4";
        public static final String FIVE = "5";
    }

}
